package com.spider.site.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.spider.site.dao.UserDao;
import com.spider.site.dao.base.BaseDao;
import com.spider.site.entity.User;

@Repository
public class UserDaoImpl extends BaseDao<User> implements UserDao{

	@SuppressWarnings("unchecked")
	@Override
	public User getByLoginId(String loginId) {
		List<User> resultList = super.entityManager.createQuery(" FROM User WHERE loginId = :loginId ")
		.setParameter("loginId", loginId).getResultList();
		if(resultList.size() > 0) {
			return resultList.get(0);
		}
		return null;
	}

}
